/*!
\copyright  Copyright (c) 2023 - 2024 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\brief      Private functions and helpers for managing background unicast data in Mirror profile.
*/

#ifndef MIRROR_PROFILE_UNICAST_BACKGROUND_DATA_H_
#define MIRROR_PROFILE_UNICAST_BACKGROUND_DATA_H_

#ifdef ENABLE_LE_MULTIPOINT_BACKGROUND_CIS_SUPPORT

#include "mirror_profile_private.h"

/*! \brief Background unicast config list */
extern mirror_profile_background_unicast_list_t mirror_unicast_background_list;

/*! \brief Get pointer to Background LEA Unicast state */
#define MirrorProfile_GetBackroundUnicastList() (&mirror_unicast_background_list)

/*! \brief Get a free Unicast entry from the background container list

    \return Pointer to a free unicast entry from background list else NULL.
*/
mirror_profile_lea_unicast_t* MirrorProfile_GetNextBackgroundUnicastFreeEntry(void);

/*! \brief Find the matching entry based on public BT address from  Unicast background List.

    \param addr The public BT address which will be used as a key to search in the unicast background list

    \return Pointer to unicast entry from background list else NULL.
*/
mirror_profile_lea_unicast_t* MirrorProfile_GetBackgroundUnicastEntryByAddr(const bdaddr *addr);

/*! \brief Find the matching entry based on GATT Connection Id from the unicast background list.

    \param cid The GATT connection identifier which will be used as a key to search in the unicast background list

    \return Pointer to unicast entry from background list else NULL.
*/
mirror_profile_lea_unicast_t* MirrorProfile_GetBackgroundUnicastEntryByCid(gatt_cid_t cid);

/*! \brief Find the matching entry based on CIS connection handle from the unicast background list.

    \param cis_handle The CIS Handle which will be used as a key to search in the unicast background list

    \return Pointer to unicast entry from background list else NULL.
*/
mirror_profile_lea_unicast_t* MirrorProfile_GetBackgroundUnicastEntryByCisHandle(hci_connection_handle_t cis_handle);

/*! \brief Find the matching entry based on audio/voice source from the unicast background list.

    \param source The Audio/voice source which will be used as a key to search in the unicast background list

    \return Pointer to unicast entry from background list else NULL.
*/
mirror_profile_lea_unicast_t* MirrorProfile_GetBackgroundUnicastEntryBySource(generic_source_t source);

/*! \brief Reset a unicast entry in the background list.

    \param  unicast_src The unicast source which will be reset.

    \return None
*/
void MirrorProfile_ResetUnicastState(mirror_profile_lea_unicast_t *unicast_src);

/*! \brief Initialize the unicast background data list.

    \return None
*/
void MirrorProfile_InitBackgroundUnicastSourceDataList(void);

#else /* ENABLE_LE_MULTIPOINT_BACKGROUND_CIS_SUPPORT */

#define MirrorProfile_GetBackgroundUnicastEntryByCid(cid)   (UNUSED(cid), NULL)

#endif /* ENABLE_LE_MULTIPOINT_BACKGROUND_CIS_SUPPORT */

#endif /* MIRROR_PROFILE_UNICAST_BACKGROUND_DATA_H_ */

